package com.my.study.io;

import java.io.Serializable;

/**
 * @author Carlos
 * @version 1.0
 * @Description Dog对象
 *
 * 序列化注意事项：
 * 1、static和transient修饰的属性是不能够给序列化的
 * 2、类的属性，也要实现序列化接口
 *
 *
 * @date 2021/6/27 10:25
 **/
public class Dog implements Serializable {
    private static final long serialVersionUID = -2481973950198935522L;

    private String name;
    private int age;
    private static String nation;
    private transient String color;

    public Dog() {
    }

    public Dog(String name, int age, String nation, String color) {
        this.name = name;
        this.age = age;
        Dog.nation = nation;
        this.color = color;
    }

    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", color='" + color + '\'' +
                ", nation='" + nation +'\'' +
                '}';
    }
}
